﻿using Autofac;
using DataServices;
using DataServices.User;
using System;

namespace AutofacProj1
{
    class Program
    {
        static void Main(string[] args)
        {
            //[1]实例化注入的容器
            ContainerBuilder builder = new ContainerBuilder();
            builder.RegisterModule<ServiceModule>();
            //容器
            var container = builder.Build();
            //接口实现 (通过注册的 ServiceModule 自动扫描命名空间下的实现类)
            IuserService _userService = container.BeginLifetimeScope().Resolve<IuserService>();

            //查询数据
            var result=_userService.UserSearch(new DataServices.User.Dto.UserSearchInput {  _UserName="小1"});

            foreach (var item in result.UserList)
            {
                Console.WriteLine($"name:{item._Name} age:{item._Age} phone:{item._PhoneNum} ");
            }

            Console.ReadLine();
        }
    }
}
